﻿module CodeCamp01.Contents
{
  import CodeCamp01.BasicTypes;
  import CodeCamp01.Events;
  
  export Presenter;
  export Presenters;
  export Session;
  export Sessions;

  // types
  
  type ShirtSize : { "M", "L", "XL", "XXL", "XXXL" };
  
  type Presenter
  {
    Id : Integer32 => AutoNumber();
    EventId : Event where value in Events;
    UserIdentityName: Text128; // username from ASP.NET membership provider
    FirstName : Text128;
    LastName : Text128;
    TwitterName : Text128?;
    EmailAddress : Text128;
    WebsiteUrl :  Text1024?;
    BlogUrl : Text1024?;
    Biography : Text4000;
    ShirtSize : ShirtSize?;
  }

  type Session
  {
    Id : Integer32 => AutoNumber();
    EventId : Event where value in Events;
    Title : Text128;
    Description : Text4000;
    SessionMaterialsUrl : Text128?;
  }
  
  type SessionPresenter
  {
    Id : Integer32 => AutoNumber();
    SessionId : Session where value in Sessions;
    PresenterId : Presenter where value in Presenters;
  }

  // extents

  Presenters : { Presenter* } where 
    identity Id, 
    unique( UserIdentityName, EventId ), 
    unique( EmailAddress, EventId );
  
  Sessions : { Session* } where 
    identity Id;
  
  SessionPresenters : { SessionPresenter* } where 
    identity Id,
    unique( SessionId, PresenterId );
}
